####
#
# Copyright 2007 B. Chandler Carruth
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
####
#
# ./lib/rcons/tools/compiler_target.rb
#
# This file provides a compiler target specialization.
#
####

require( 'rcons/tool_target' )

module RCons

  # Provides an extremely simple representation of a compiler to be used
  # in a build process.
  #
  # Any child class should implement the following methods:
  #
  # - +compile+
  #
  # An example of a child class:  +CCompilerTarget+
  #
  # Extends +ToolTarget+.
  class CompilerTarget < ToolTarget

    # Initializes the compiler object, mostly handled by the constructor
    # for +ToolTarget+.  Any compiler-specific initialization procedures
    # should be added to the constructor of any child class.
    #
    # Inputs:
    #
    # +build_env+:: an +Environment+.
    # +name+:: the name of the target.
    # +opts+:: a list of options.
    def initialize( build_env, name, opts = Hash.new() )
      # handle all the defaults for a target
      super( build_env, File.join( 'compiler', name ), opts )

    end

    # An abstract method that should be implemented in any child class to
    # compile source files.
    #
    # An example implemented function: GccCCompiler#compile
    #
    # Inputs:
    #
    # +target_file+:: the name given to the compiled files.
    # +src_files+:: the remainder of the parameters specifying source files
    def compile( target_file, *src_files )
      false
    end

  end
end

